﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Delivery_Type.ascx.cs" Inherits="Shop.Web.Controls.Delivery_Type" %>
<div>
Возможные варианты доставки для адреса: <asp:Label ID="lblAddresName" runat="server"></asp:Label><br />
<asp:Repeater runat="server" ID="rprDeliveryType">
<HeaderTemplate></HeaderTemplate>
<ItemTemplate>
    <input onclick="$('#hdnDelType').val(this.value)" type="radio" name="deliveryType" value='<%# DataBinder.Eval(Container, "DataItem.Id")%>' id='delivery_<%# DataBinder.Eval(Container, "DataItem.Id")%>'/> <%# DataBinder.Eval(Container, "DataItem.Name")%>. <%# DataBinder.Eval(Container, "DataItem.Description")%> Стоимость: <%# DataBinder.Eval(Container, "DataItem.Price", "{0:C}")%>
    <br/>
</ItemTemplate>
<FooterTemplate></FooterTemplate>
</asp:Repeater>
<input type="hidden" id="hdnDelType" value="1"/>
<script type="text/javascript">

    
    function setRadioGroupValue(val) {
        radioGroupObj = document.getElementsByName("deliveryType");
        for (var i = 0; i < radioGroupObj.length; i++)
            if (radioGroupObj[i].value == val) {
                radioGroupObj[i].checked = true;
                return radioGroupObj[i].value;
        }
        return null;
    }
    
    setRadioGroupValue("1");
    
    function getRadioGroupValue() {
        radioGroupObj = document.getElementsByName("deliveryType");
        for (var i = 0; i < radioGroupObj.length; i++)
            if (radioGroupObj[i].checked) {
            return radioGroupObj[i].value;
        }
        return null;
    }
</script>
</div>

